<template>
	<view class="container">
		<view class="item" v-for="(item,index) in dataList" :key="index" @click="jump(item)">
			<image :src="item.contractImg" class="img"></image>
			<view class="item-text">
				<text class="name">{{item.houseName}}</text>
				<text class="time">租赁时间：{{item.leaseTime}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: []
			}
		},
		onLoad() {
			this.getLeasingInformationList()
		},
		methods: {
			//获取数据
			async getLeasingInformationList() {
				const res = await this.$api.getLeasingInformationList({
					pageIndex: -1,
					pageSize: -1,
					tenantName: uni.getStorageSync('user').name,
				})
				// console.log(res)
				this.dataList = res.records
			},
			jump(item) {
				uni.navigateTo({
					url: '/pages/leaseDetails/leaseDetails?data=' + JSON.stringify(item)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		min-height: 94vh;
		background-color: #f4f4f5;
		padding: 0 40rpx;
		display: flex;
		flex-direction: column;

		.item {
			background-color: #fff;
			border-radius: 20rpx;
			overflow: hidden;
			height: 200rpx;
			margin-top: 40rpx;
			display: flex;
			align-items: center;

			.img {
				width: 300rpx;
				height: 100%;
			}

			.item-text {
				display: flex;
				flex-direction: column;
				margin-left: 40rpx;

				.name {
					font-size: 32rpx;
				}

				.time {
					margin-top: 20rpx;
					font-size: 28rpx;
					color: #849aae;
				}
			}
		}
	}
</style>